<script setup>
import { useRouter } from "vue-router";
import myAxios from "../plugins/myAxios.js";
import { ref, onMounted } from "vue";
import { getCurrentUser, exit } from "../services/user.js";
const router = useRouter();
const user = ref({});
// onMounted钩子函数，发请求获取User信息
onMounted(async () => {
    user.value = await getCurrentUser();
});
// 退出登录
const logout = () => {
    exit(router);
};
</script>
<template>
    <van-cell title="昵称" :value="user.username" />
    <van-cell title="头像">
        <img :src="user.avatarUrl" style="height: 48px" />
    </van-cell>
    <van-cell title="个人详情" is-link to="/inter/user/detail" />
    <van-cell title="创建队伍" is-link to="/inter/user/createTeam" />
    <van-cell title="我加入的队伍" is-link to="/inter/user/myAddTeam" />
    <van-cell title="我管理的队伍" is-link to="/inter/user/myCreateTeam" />
    <van-cell title="我的标签" is-link :to="{
      path: '/inter/user/myTag',
      query: {
        userId: user.id,
        hasTagList: user.tags,
      }
    }"/>
    <van-cell title="退出登录" @click="logout" />
</template>
<style scoped lang="scss"></style>
